package com.zoffy.oj_backend.model.vo;

import cn.hutool.json.JSONUtil;
import com.zoffy.oj_backend.model.dto.question.JudgeConfig;
import com.zoffy.oj_backend.model.entity.Question;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;
@Data
public class QuestionTinyVo {
    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 题目标签
     */
    private List<String> tags;

    /**
     * 题目提交数
     */
    private Integer submitNum;

    /**
     * 题目通过数
     */
    private Integer acceptedNum;


    public static QuestionTinyVo obj2Vo(Question question) {
        if (question == null) {
            return null;
        }
        QuestionTinyVo questionTinyVo = new QuestionTinyVo();
        BeanUtils.copyProperties(question, questionTinyVo);
        List<String> tags = JSONUtil.parseArray(question.getTags()).toList(String.class);

        questionTinyVo.setTags(tags);
        return questionTinyVo;
    }













}
